<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
dd
<div id="da"></div>
<script>

var str = "<div id='content_div_1723'><div id='content_div_1720'><a href='http://cosi-test.scms.waikato.ac.nz/listdata/keywords/computer-science3'>Computer Science</a></div><div id='content_div_1720'><a href='http://cosi-test.scms.waikato.ac.nz/listdata/keywords/computer-science6'>Imaging</a></div>";

document.getElementById("da").innerHTML = "";
 function listAllLinks( strSrc,optAtt ) {
var arrAllLinks = strSrc.match(/(https:\/\/|http:\/\/|ftp:\/\/|www.)([^\s]*)/gi );
return arrAllLinks.join( ' ,' ).replace( /(https:\/\/|http:\/\/|ftp:\/\/|www.)([^,]*)/gi,
'<a href=http://$2 >$1$2</a>' );
}
	
//alert(listAllLinks(str,""));
document.getElementById("da").innerHTML = listAllLinks(str,"");


 
 function listAllLinks( strSrc,blnClickable,optAtt ) {
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// listAllLinks function
// author: T. Kang
// contact: txkang@hotmail.com
// Extract every link in string and list them in order.
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
var arrAllLinks

if ( !blnClickable ) {
arrAllLinks = strSrc.match(/(https:\/\/|http:\/\/|ftp:\/\/|www.)([^\s]*)/gi );
return arrAllLinks.join( ',' ); 
}
else {
arrAllLinks = strSrc.match(/(https:\/\/|http:\/\/|ftp:\/\/|www.)([^\s]*)/gi );
return arrAllLinks.join( ',' ).replace( /(https:\/\/|http:\/\/|ftp:\/\/|www.)([^,]*)/gi,
'<a href=http://$2 ' + optAtt + '>$1$2</a>' );
}
}
//alert(listAllLinks(str,""));
document.getElementById("da").innerHTML = "d"+ listAllLinks(str,true,"");

 </script>
</body>
</html>
